package com.example.pengsiyuan.ppbluetoothle.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;

import com.example.pengsiyuan.ppbluetoothle.R;
import com.example.pengsiyuan.ppbluetoothle.util.PPUtil;
import com.peng.ppscalelibrary.BleManager.Interface.BleBMDJInterface;
import com.peng.ppscalelibrary.BleManager.Interface.BleBMDJParttenInterface;
import com.peng.ppscalelibrary.BleManager.Manager.BleManager;

public class BMDJTimeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bmdjtime);
        final TextView textView = findViewById(R.id.timetextview);
        BleManager.shareInstance(getApplication()).BMDJTimeInterval(new BleBMDJInterface() {
            @Override
            public void timeInterval(int timeInterval, boolean isEnd) {
                double second = (double) (timeInterval / 10.0);
                textView.setText(PPUtil.keep1Point3(second) + "");
                if (isEnd){
                    BleManager.shareInstance(getApplication()).dissconnectBMScale();
                }
            }
        });
    }

}
